<template>
  <div class="Footer-container">
    {{msg}}
    姓名：
    <input type="text" v-model="name" />
    年龄：
    <input type="text" v-model="age" />
    性别:
    <select v-model="sex">
      <option value="男">男</option>
      <option value="女">女</option>
    </select>
    <button @click="add">添加</button>
    <table border="1" style="width: 500px;">
      <thead>
        <tr>
          <th>序号</th>
          <th>姓名</th>
          <th>年龄</th>
          <th>性别</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        <tr :key="item.id" v-for="item in people">
          <td>{{item.id}}</td>
          <td>{{ item.name }}</td>
          <td>{{ item.age }}</td>
          <td>{{ item.gender }}</td>
          <td>
            <button @click="del(item.id)">删除</button>
            <button @click="xiu">修改</button>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
export default {
  data () {
    return {
      msg: '御剑乘风来,除魔天地间!====FooterCom',
      name: '',
      age: '',
      sex: '',
      people: [
        { id: 1, name: '张三', age: 25, gender: '男' },
        { id: 2, name: '李四', age: 30, gender: '女' },
        { id: 3, name: '王五', age: 28, gender: '男' },
        { id: 4, name: '赵六', age: 27, gender: '女' },
        { id: 5, name: '钱七', age: 35, gender: '男' }
      ]
    }
  },
  created () {
  },
  computed: {
  },
  methods: {
    add () {
      this.people.push({
        id: this.people.length,
        name: this.name,
        age: this.age,
        gender: this.sex
      })
      this.name = this.age = this.sex = ''
    },
    del (e) {
      this.people = this.people.filter(ele => ele.id !== e)
    }
  }
}
</script>
<style lang='less'  scoped>
.Footer-container {
  display: flex;
  flex-direction: column;
  input {
    width: 200px;
  }
  select {
    width: 200px;
  }
  button {
    width: 40px;
  }
}
</style>
